# -*- coding: utf-8 -*-

from py_process.py_managers.py_client import ClientManager
import sys
import uuid
import time
import logging

logger = logging.getLogger(__name__)


def logger_config():
    logger_format = '%(asctime)s.%(msecs)03d %(processName)24s %(funcName)16s %(lineno)3d  %(message)s'
    logging.basicConfig(format=logger_format, datefmt='%H:%M:%S', level=logging.INFO, stream=sys.stdout)
    pass


def master_client():
    client_manager = ClientManager(address=('127.0.0.1', 5000), authkey=b'chench')
    client_manager.connect()

    master_queue = client_manager.get_master_queue()

    for i in range(1):
        temp = uuid.uuid4()
        logger.info('%s:%s', i, temp)
        master_queue.put(temp)
        pass

    worker_queue = client_manager.get_worker_queue()
    for i in range(10):
        temp = uuid.uuid4()
        logger.info('%s:%s', i, temp)
        worker_queue.put(temp)
        pass


if __name__ == '__main__':
    logger_config()
    master_client()
    time.sleep(60 * 3)
    pass
